package com.base.mybatisplus.Test;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.base.mybatisplus.entity.User;
import com.base.mybatisplus.mapper.UserMapper;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.sql.Wrapper;
import java.util.List;

/**
 * ClassName: sampleTest
 * PackageName: com.base.mybatisplus.Test
 * Describe:
 *
 * @author: Cheng Wenying
 * @Create: 2024/1/30
 * @version:
 */
@Component
public class SampleTest implements ApplicationRunner {

    @Autowired
    private UserMapper userMapper;


    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.out.println("=== 查询===");
        EntityWrapper<User> wrapper = new EntityWrapper<>();
        wrapper.eq("name","Tom");
        List<User> userList = userMapper.selectList(wrapper);
        userList.forEach(System.out::println);
        System.out.println(" ==========");
        List<User> users = userMapper.SelectAllData();
        users.forEach(System.out::println);
    }
}
